public class Primenumber1 {
    public static void main(String[] args) {
        int j;
        int count=0;
        boolean flag;
        for(int i=2;i<2000;i++){
            flag=false;
            for(j=2;j<i;j++){
                if(i%j==0){
                    flag=true;
                    break;
                }
            }
            if(!flag){

                if(count%5 ==0) {
                    System.out.println();
                }
                count++;
                System.out.print(i+" ");
            }
        }
    }
}